@()

@widgets.dialog(title = "New Project", submitLabel = "Create") {
  <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
    <input class="mdl-textfield__input" type="text" id="project_name" name="project_name"/>
    <label class="mdl-textfield__label" for="project_name">Name</label>
  </div>

  <script>//<![CDATA[
    function submit() {
      console.log("submit()");
      var name = $("input[name='project_name']").val();

      $.ajax({
        type: 'PUT',
        url: '@config.baseUrl/workspace/projects/' + name,
        data: "",
        success: function(data) {
          closeDialog();
          reloadWorkspace();
        },
        error: function(request) {
          alert(request.responseText);
        }
      });
    }
  //]]>
  </script>
}